# Makefile

# Compiler
FC = gfortran

# Compiler flags
FFLAGS = -c -fPIC

# Source files
SRC = example1.f90 example2.f90 example3.f90 main.f90

# Object files
OBJ = $(SRC:.f90=.o)

# Shared library
LIB = libexample.so

# Default target
all: $(LIB)

# Rule to create the shared library
$(LIB): $(OBJ)
	$(FC) -shared -o $@ $^

# Rule to compile .f90 files to .o files
%.o: %.f90
	$(FC) $(FFLAGS) $<

# Clean up
clean:
	rm -rf $(OBJ) $(LIB) *.mod
